package com.zyg.ioc;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestIoc {

	public static void main(String[] args) {
		//注解配置用来定义配置文件路径
		//String xmlPath = "com/zyg/ioc/applicationContext2.xml";
		
		//1.初始化spring容器，加载配置文件信息
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext2.xml");
		//2.通过容器获取userService实例
		UserService userService = (UserService) applicationContext.getBean("userService");
		//3.调用实例中的方法
		userService.updUser();
		userService.delUser();
		

	}

}
